package org.eclipse.rally.plugin.views;

import java.util.Calendar;
import java.util.Date;

import org.eclipse.rally.plugin.utils.SWTResourceManager;
import org.eclipse.rally.plugin.webservice.RallyMain;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;

import com.rallydev.webservice.v1_12.domain.Defect;
/**
 * EditDefectDetailGUI
 * @author Nadeem Khan
 * 
 */

public class EditDefectDetailGUI {
    public static Shell shell;
    private static Button button;
    public static Text lblValue_4; 
    public static Composite composite ;
     public static ScrolledComposite scrolledComposite;
   public static DefectDetailGUI dbg;
    public static Group group;
    private static Text text,tragetdate;
    private static Text txtSearchTestCase;
    private static Defect defect;
    private static CCombo packagecombo;
    private static Combo project; 
    private static CCombo state;
    private static CCombo priority;
    private static CCombo submittedby;
    private static Text found_in; 
    private static Text fixed_in;
    private static Text verified_in;
    private static Text target_build;
    private static Combo resolution;
    private static Combo release;
    private static Combo envcombo;
    private static CCombo Scheduledstate;
    private static Text plan_estimate;
    private static Text task_estimate;
    private static CCombo cseverity;
    private static Text client_def_id;
    private static CCombo root_cause;
    private static CCombo owner;
    
    public static void main(String[] args) {
        Display display = new Display();
        shell = new Shell(display);
        shell.setMinimumSize(new Point(400, 1600));
        shell.setLayout(new FillLayout());
        String i="ref";
        String id = "DE5731";
        TabFolder tabFolder = new TabFolder(shell, SWT.NONE);
        TabItem tbtmIssuedetail = new TabItem(tabFolder, SWT.NONE);
        tbtmIssuedetail.setText("Edit Defect &Detail");
        editdefectDetail(tabFolder, tbtmIssuedetail, id,i);
        
        shell.setSize(900, 1000);
        shell.open();

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }

        display.dispose();
    }

    /*public static void Show()
    {*/
    public static void editdefectDetail(final TabFolder tabFolder,final TabItem tabItem, final String defectRefrence, final String pageName) {
    	try{
    	defect = (Defect) RallyMain.readDefectObject(defectRefrence);
    	
         scrolledComposite = new ScrolledComposite(tabFolder, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    	tabItem.setControl(scrolledComposite);
    	scrolledComposite.setExpandHorizontal(true);
    	scrolledComposite.setExpandVertical(true);
    	
    	 composite = new Composite(scrolledComposite, SWT.BORDER);
    	composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
     
        group = new Group(composite, SWT.BORDER);
        group.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));
        group.setBounds(10, 10, 850, 1339);

        {
            Label lblGeneral = new Label(group, SWT.BORDER);
            lblGeneral.setForeground(SWTResourceManager.getColor(
                    SWT.COLOR_WIDGET_BORDER));
            lblGeneral.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_TITLE_INACTIVE_BACKGROUND));
            lblGeneral.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.BOLD));
            lblGeneral.setBounds(0, 0, 168, 21);
            lblGeneral.setText("General");

        Label lblId = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblId.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblId.setBounds(0, 20, 166, 21);
        lblId.setText("ID :");
        lblId.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblId.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblName = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblName.setBounds(0, 40, 166, 24);
        lblName.setText("Name :");
        lblName.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
        lblName.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblName.setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_RED));

        Label lblDescription = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblDescription.setBounds(0, 63, 166, 250);
        lblDescription.setText("Description:");
        lblDescription.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblDescription.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblDescription.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblAttachments = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblAttachments.setBounds(0, 313, 166, 59);
        lblAttachments.setText("Attachments:");
        lblAttachments.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblAttachments.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblAttachments.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblOwner = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblOwner.setBounds(0, 369, 166, 21);
        lblOwner.setText("Owner:");
        lblOwner.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblOwner.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        lblOwner.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblProject = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblProject.setBounds(0, 389, 166, 21);
        lblProject.setText("Project:");
        lblProject.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
        lblProject.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        lblProject.setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_RED));

        {
            Label label = new Label(group, SWT.SEPARATOR | SWT.VERTICAL);
            label.setForeground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_SELECTION));
            label.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_SELECTION));
            label.setBounds(166, 20, 2, 411);
        }

        Label lblDefect = new Label(group, SWT.BORDER);
        lblDefect.setBounds(0, 410, 168, 21);
        lblDefect.setText("Defect");
        lblDefect.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_WIDGET_BORDER));
        lblDefect.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.BOLD));
        lblDefect.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_BACKGROUND));

        Label lblState = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblState.setBounds(0, 430, 166, 21);
        lblState.setText("State:");
        lblState.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
        lblState.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblState.setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_RED));

        Label lblPriority = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblPriority.setBounds(0, 475, 166, 21);
        lblPriority.setText("Submitted By:");
        lblPriority.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblPriority.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblPriority.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblFoundIn = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblFoundIn.setBounds(0, 495, 166, 21);
        lblFoundIn.setText("Found In:");
        lblFoundIn.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblFoundIn.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblFoundIn.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblTargetBuild = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblTargetBuild.setBounds(0, 538, 166, 21);
        lblTargetBuild.setText("Resolution:");
        lblTargetBuild.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblTargetBuild.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblTargetBuild.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblResolution = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblResolution.setBounds(0, 559, 166, 23);
        lblResolution.setText("Release Note:");
        lblResolution.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblResolution.setFont(SWTResourceManager.getFont("Tahoma", 10,
                SWT.NORMAL));
        lblResolution.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblReleaseNote = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblReleaseNote.setBounds(0, 448, 166, 27);
        lblReleaseNote.setText("Priority:");
        lblReleaseNote.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblReleaseNote.setFont(SWTResourceManager.getFont("Tahoma", 10,
                SWT.NORMAL));
        lblReleaseNote.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label label = new Label(group, SWT.SEPARATOR);
        label.setBounds(166, 430, 2, 193);
        label.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));
        label.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));

        Label lblSchedule = new Label(group, SWT.BORDER);
        lblSchedule.setBounds(0, 602, 168, 21);
        lblSchedule.setText("Schedule");
        lblSchedule.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_WIDGET_BORDER));
        lblSchedule.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.BOLD));
        lblSchedule.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_BACKGROUND));

        Label lblScheduleState = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblScheduleState.setBounds(0, 623, 166, 23);
        lblScheduleState.setText("Schedule State:");
        lblScheduleState.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
        lblScheduleState.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblScheduleState.setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_RED));

        Label lblRelease = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblRelease.setBounds(0, 645, 166, 23);
        lblRelease.setText("Release:");
        lblRelease.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblRelease.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblRelease.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblPlanEstimate = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblPlanEstimate.setBounds(0, 667, 166, 23);
        lblPlanEstimate.setText("Plan Estimate:");
        lblPlanEstimate.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblPlanEstimate.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblPlanEstimate.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblToDo = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblToDo.setBounds(0, 689, 166, 23);
        lblToDo.setText("To Do:");
        lblToDo.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblToDo.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        lblToDo.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblTargetBuild_1 = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblTargetBuild_1.setBounds(0, 515, 166, 23);
        lblTargetBuild_1.setText("Target Build:");
        lblTargetBuild_1.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblTargetBuild_1.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblTargetBuild_1.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblActual = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblActual.setBounds(0, 712, 166, 21);
        lblActual.setText("Actual:");
        lblActual.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblActual.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        lblActual.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

       final Browser lblValue_1 = new Browser(group, SWT.BORDER);
        
		lblValue_1.setBounds(172, 40, 672, 21);
		
		if(defect.getName() != null)
			lblValue_1.setText(defect.getName());
			else
				lblValue_1.setText("");
		lblValue_1.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
		lblValue_1.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
		lblValue_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));

       
      
		final Browser lblValue = new Browser(group, SWT.BORDER );
		//lblValue.setText("Nadeem");
		//lblValue.setAlignment(SWT.LEFT);
		lblValue.setBounds(172, 63, 672, 244);
		if(defect.getDescription() != null){
		String description = 	defect.getDescription().replace("<br>","\n\n");
		lblValue.setText(description);
		}else
			lblValue.setText("");
		//lblValue.setLineIndent(0, 1, 50);
		//lblValue.setLineJustify(4, 1, true);
		lblValue.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
		lblValue.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
		lblValue.setBackground(SWTResourceManager
				.getColor(SWT.COLOR_LIST_BACKGROUND));
		
        final Text lblValue_3 = new Text(group, SWT.BORDER | SWT.LEFT);
        lblValue_3.setBounds(172, 313, 672, 21);
       
        lblValue_3.setText("Sreekanth");
        lblValue_3.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblValue_3.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblValue_3.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));

        {
        	owner = new CCombo(group, SWT.BORDER);
        	 if(defect.getOwner() != null && DefectsTabGUI.getUsrName(defect.getOwner()) != null)
        		 owner.setText(DefectsTabGUI.getUsrName(defect.getOwner()));
         		else
         			owner.setText("");	
        	 owner.setBounds(172, 369, 166, 21);
        	 DefectsTabGUI.setUsers(owner);
        }
        
        /*lblValue_4 = new Text(group, SWT.BORDER);
        lblValue_4.setBounds(172, 369, 166, 21);
        if(defect.getOwner() != null)
    		lblValue_4.setText(defect.getOwner());
    		else
    			lblValue_4.setText("");	
        lblValue_4.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblValue_4.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        lblValue_4.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));*/
        
		final Text attachment = new Text(group, SWT.BORDER);
		attachment.setBounds(172, 346, 286, 19);
                {
		Button btnBrowse = new Button(group, SWT.NONE);
		btnBrowse.setBounds(476, 346, 68, 20);
		btnBrowse.setText("Browse");
		
		btnBrowse.addListener(SWT.Selection, new Listener() {
		      public void handleEvent(Event event) {
		    	final Shell dialog = new Shell (shell, SWT.DIALOG_TRIM);
		        FileDialog fileDialog = new FileDialog(dialog, SWT.MULTI);
		        String fileFilterPath = "F:/jdk1.5";
		        fileDialog.setFilterPath(fileFilterPath);
		        
		        fileDialog.setFilterExtensions(new String[]{"*.rtf", "*.html", "*.*"});
		        fileDialog.setFilterNames(new String[]{ "Rich Text Format", "HTML Document", "Any"});
		        
		        String firstFile = fileDialog.open();

		        if(firstFile != null) {
		          fileFilterPath = fileDialog.getFilterPath();
		          String[] selectedFiles = fileDialog.getFileNames();
		          StringBuffer sb = new StringBuffer(fileDialog.getFilterPath());
		          for(int i=0; i<selectedFiles.length; i++) {
		            sb.append(selectedFiles[i]);
		          }
		          attachment.setText(sb.toString());
		        }
		        dialog.pack();
			    dialog.open();
			    dialog.close();
		      }
		      
		    });
		
		  }

        found_in = new Text(group, SWT.BORDER | SWT.LEFT);
        found_in.setBounds(172, 496, 266, 20);
        if(defect.getFoundInBuild() != null)
        	found_in.setText(defect.getFoundInBuild());
    		else
    			found_in.setText("");	
        found_in.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        found_in.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        found_in.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));
      

      /*  final Text label_6 = new Text(group, SWT.BORDER | SWT.LEFT);
        label_6.setBounds(172, 582, 166, 21);
        label_6.setText("Search User Story");
        label_6.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        label_6.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        label_6.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));*/

        target_build = new Text(group, SWT.BORDER | SWT.LEFT);
        target_build.setBounds(172, 517, 266, 20);
        if (defect.getTargetBuild() != null)
        	target_build.setText(defect.getTargetBuild());
        		else
        			target_build.setText("");
        target_build.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        target_build.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        target_build.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));
        

        plan_estimate = new Text(group, SWT.BORDER | SWT.BORDER);
        plan_estimate.setBounds(172, 667, 166, 21);
        if (defect.getPlanEstimate() != null)
        	plan_estimate.setText(String.valueOf(defect.getPlanEstimate()));
		else
			plan_estimate.setText("");
        plan_estimate.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        plan_estimate.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        plan_estimate.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));

        final Text label_11 = new Text(group, SWT.BORDER | SWT.BORDER);
        label_11.setBounds(172, 689, 166, 21);
        label_11.setText("To do");
        label_11.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        label_11.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        label_11.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));

        final Text label_12 = new Text(group, SWT.BORDER | SWT.BORDER);
        label_12.setBounds(172, 712, 166, 21);
        label_12.setText("Actual");
        label_12.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        label_12.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        label_12.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));

        Label lblCustom = new Label(group, SWT.BORDER);
        lblCustom.setBounds(0, 730, 168, 21);
        lblCustom.setText("Custom");
        lblCustom.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_WIDGET_BORDER));
        lblCustom.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.BOLD));
        lblCustom.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_BACKGROUND));

        Label lblCitiSeverity = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblCitiSeverity.setBounds(0, 748, 166, 24);
        lblCitiSeverity.setText("Citi Severity:");
        lblCitiSeverity.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblCitiSeverity.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblCitiSeverity.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
        
        Label lblClientdefectid = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblClientdefectid.setBounds(0, 772, 166, 23);
        lblClientdefectid.setText("ClientDefectID:");
        lblClientdefectid.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblClientdefectid.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblClientdefectid.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        client_def_id = new Text(group, SWT.BORDER | SWT.RIGHT);
        client_def_id.setBounds(172, 772, 672, 21);
        if(defect.getClientDefectID()!= null)
        	client_def_id.setText(defect.getClientDefectID());
    		else
    			client_def_id.setText("");
        client_def_id.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        client_def_id.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        client_def_id.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));

        Label label_17 = new Label(group, SWT.SEPARATOR);
        label_17.setBounds(166, 623, 2, 112);
        label_17.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));
        label_17.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));

        Label lblEnvironment = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblEnvironment.setBounds(444, 430, 166, 23);
        lblEnvironment.setText("Environment:");
        lblEnvironment.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblEnvironment.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblEnvironment.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblSeverity = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblSeverity.setBounds(444, 453, 166, 21);
        lblSeverity.setText("Severity:");
        lblSeverity.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblSeverity.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblSeverity.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblCreationDate = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblCreationDate.setBounds(444, 474, 166, 22);
        lblCreationDate.setText("Creation Date:");
        lblCreationDate.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblCreationDate.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblCreationDate.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblFixedIn = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblFixedIn.setBounds(444, 496, 166, 21);
        lblFixedIn.setText("Fixed In:");
        lblFixedIn.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblFixedIn.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblFixedIn.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblVerifiedIn = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblVerifiedIn.setBounds(444, 517, 166, 23);
        lblVerifiedIn.setText("Verified In:");
        lblVerifiedIn.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblVerifiedIn.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblVerifiedIn.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblTargetDate = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblTargetDate.setBounds(444, 540, 166, 21);
        lblTargetDate.setText("Target Date:");
        lblTargetDate.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblTargetDate.setFont(SWTResourceManager.getFont("Tahoma", 10,
                SWT.NORMAL));
        lblTargetDate.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblAffectsDoc = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblAffectsDoc.setBounds(444, 561, 166, 23);
        lblAffectsDoc.setText("Affects Doc:");
        lblAffectsDoc.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblAffectsDoc.setFont(SWTResourceManager.getFont("Tahoma", 10,
                SWT.NORMAL));
        lblAffectsDoc.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label label_18 = new Label(group, SWT.SEPARATOR);
        label_18.setBounds(610, 430, 2, 173);
        label_18.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));
        label_18.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));
 
        final Text label_21 = new Text(group, SWT.BORDER);
        label_21.setBounds(615, 474, 166, 21);
        if(defect.getSeverity() != null)
    		label_21.setText(defect.getSeverity());
    		else
    			label_21.setText("");
        label_21.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        label_21.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        label_21.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));

        fixed_in = new Text(group, SWT.BORDER);
        fixed_in.setBounds(615, 496, 229, 20);
        if(defect.getFixedInBuild() != null)
        	fixed_in.setText(defect.getFixedInBuild());
    		else
    			fixed_in.setText("");	
        fixed_in.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        fixed_in.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        fixed_in.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));

        verified_in = new Text(group, SWT.BORDER);
        verified_in.setBounds(615, 517, 229, 20);
        if(defect.getVerifiedInBuild() != null)
        	verified_in.setText(defect.getVerifiedInBuild());
    		else
    			verified_in.setText("");
        verified_in.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        verified_in.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        verified_in.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));
      
        Label label_27 = new Label(group, SWT.RIGHT);
        label_27.setBounds(172, 20, 166, 20);
        if(defect.getFormattedID() != null)
    		label_27.setText(defect.getFormattedID());
    		else
    			label_27.setText("");	
        label_27.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        label_27.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        label_27.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));
        label_27.setAlignment(SWT.LEFT);

        Label label_28 = new Label(group, SWT.BORDER);
        label_28.setBounds(160, 427, 800, 3);
        label_28.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_WIDGET_BORDER));
        label_28.setFont(SWTResourceManager.getFont("Times New Roman", 13,
                SWT.BOLD));
        label_28.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_BACKGROUND));

        Label label_29 = new Label(group, SWT.BORDER);
        label_29.setBounds(160, 620, 800, 3);
        label_29.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_WIDGET_BORDER));
        label_29.setFont(SWTResourceManager.getFont("Times New Roman", 13,
                SWT.BOLD));
        label_29.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_BACKGROUND));

        Label label_30 = new Label(group, SWT.BORDER);
        label_30.setBounds(160, 745, 800, 3);
        label_30.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_WIDGET_BORDER));
        label_30.setFont(SWTResourceManager.getFont("Times New Roman", 13,
                SWT.BOLD));
        label_30.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_BACKGROUND));

        Label lblBlocked = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblBlocked.setBounds(444, 623, 166, 21);
        lblBlocked.setText("Blocked:");
        lblBlocked.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblBlocked.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblBlocked.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblIteration = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblIteration.setBounds(444, 643, 166, 21);
        lblIteration.setText("Iteration:");
        lblIteration.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblIteration.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblIteration.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label lblTaskEstimate = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblTaskEstimate.setBounds(444, 663, 166, 21);
        lblTaskEstimate.setText("Task Estimate:");
        lblTaskEstimate.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblTaskEstimate.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblTaskEstimate.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
        task_estimate = new Text(group, SWT.BORDER | SWT.BORDER);
        task_estimate.setBounds(615, 663, 166, 21);
        if(defect.getTaskEstimateTotal()!= null)
        	task_estimate.setText(String.valueOf(defect.getTaskEstimateTotal()));
    		else
    			task_estimate.setText("");
        task_estimate.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        task_estimate.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        task_estimate.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));

        Label label_34 = new Label(group, SWT.SEPARATOR);
        label_34.setBounds(610, 623, 2, 61);
        label_34.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));
        label_34.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));

      
        Label lblCorrectiveActionca = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblCorrectiveActionca.setBounds(0, 795, 166, 43);
        lblCorrectiveActionca.setText("Corrective Action (CA): ");
        lblCorrectiveActionca.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblCorrectiveActionca.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblCorrectiveActionca.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        final Text label_36 = new Text(group, SWT.BORDER | SWT.BORDER);
        label_36.setBounds(172, 795, 672, 41);
        if(defect.getCorrectiveActionCA()!= null)
        	label_36.setText(defect.getCorrectiveActionCA());
    		else
    			label_36.setText("");
        label_36.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        label_36.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        label_36.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));
        Label lblPreventiveActionspa = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblPreventiveActionspa.setBounds(0, 838, 166, 40);
        lblPreventiveActionspa.setText("Preventive Actions (PA):");
        lblPreventiveActionspa.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblPreventiveActionspa.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblPreventiveActionspa.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        final Text label_15 = new Text(group, SWT.BORDER | SWT.BORDER);
        label_15.setBounds(172, 838, 672, 41);
        if(defect.getPreventiveActionsPA()!= null)
        	label_15.setText(defect.getPreventiveActionsPA());
    		else
    			label_15.setText("");
        label_15.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        label_15.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        label_15.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));
 
        Label lblReopenStatus = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblReopenStatus.setBounds(0, 877, 166, 21);
        lblReopenStatus.setText("Re-Open Status:");
        lblReopenStatus.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_BLACK));
        lblReopenStatus.setFont(SWTResourceManager.getFont("Tahoma", 9,
                SWT.NORMAL));
        lblReopenStatus.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
      
        Label lblNotes = new Label(group, SWT.BORDER);
        lblNotes.setBounds(0, 918, 168, 21);
        lblNotes.setText("Notes");
        lblNotes.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_WIDGET_BORDER));
        lblNotes.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.BOLD));
        lblNotes.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_BACKGROUND));

        Label label_35 = new Label(group, SWT.BORDER);
        label_35.setBounds(160, 933, 800, 3);
        label_35.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_WIDGET_BORDER));
        label_35.setFont(SWTResourceManager.getFont("Times New Roman", 13,
                SWT.BOLD));
        label_35.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_BACKGROUND));

        Label lblRootCause = new Label(group, SWT.RIGHT);
        lblRootCause.setBounds(0, 898, 166, 21);
        lblRootCause.setText("Root Cause:");
        lblRootCause.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblRootCause.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblRootCause.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
    

        Label lblNotes_1 = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblNotes_1.setBounds(0, 938, 166, 323);
        lblNotes_1.setText("Notes :");
        lblNotes_1.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
        lblNotes_1.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblNotes_1.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_TITLE_INACTIVE_FOREGROUND));

        Label label_38 = new Label(group, SWT.SEPARATOR);
        label_38.setBounds(166, 710, 2, 100);
        label_38.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));
        label_38.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));

        Label label_39 = new Label(group, SWT.SEPARATOR);
        label_39.setBounds(166, 809, 2, 494);
        label_39.setForeground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));
        label_39.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_SELECTION));
        Browser notes = new Browser(group, SWT.BORDER);
      
        notes.setBounds(172, 937, 672, 323);
       
        if(defect.getNotes()!= null)
        	notes.setText(defect.getNotes());
    		else
    			notes.setText("");
	
		notes.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
		notes.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
		notes.setBackground(SWTResourceManager
				.getColor(SWT.COLOR_LIST_BACKGROUND));

        {
        	final Label back = new Label(group, SWT.NONE);
        	back.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_TITLE_INACTIVE_BACKGROUND));
        	back.setImage(SWTResourceManager.getImage(EditDefectDetailGUI.class, "/icons/Back-enabled.gif"));
        	back.setBounds(794, 0, 50, 19);
        	back.addMouseTrackListener(new MouseTrackAdapter() {
				@Override
				public void mouseHover(MouseEvent e) {
					final Cursor cursor = new Cursor(Display.getCurrent(),
							SWT.CURSOR_HAND);

					back.setCursor(cursor);

				}
			});
        	back.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseDown(MouseEvent e) {
                    composite.dispose();
                    group.dispose();
                    //int i=2;
                    	dbg =new DefectDetailGUI();//.
                    dbg.defectDetail(tabFolder, tabItem, defectRefrence, pageName);
                
                   
                    }
			});
        }
               
        Label lblAddNote = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblAddNote.setBounds(0, 1261, 166, 41);
        lblAddNote.setText("Add Note :");
        lblAddNote.setForeground(SWTResourceManager.getColor(0, 0, 0));
        lblAddNote.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        lblAddNote.setBackground(SWTResourceManager.getColor(216, 228, 248));
        
        Label label_01 = new Label(group, SWT.NONE);
        label_01.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND));
        label_01.setBounds(0, 1302, 166, 2);
        {
        	final Button btnSubmit = new Button(group, SWT.NONE);
        	btnSubmit.setBounds(444, 1308, 68, 23);
        	btnSubmit.setText("Submit");
        	btnSubmit.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseDown(MouseEvent e) {
               	 System.out.println("in submit()");
               	 try{
               	 editDefectDetails();
               	 composite.dispose();
                 group.dispose();
                 int i=2;
                 dbg =new DefectDetailGUI();
                 dbg.defectDetail(tabFolder, tabItem, defectRefrence,pageName);
               	 }catch (Exception e1) {
						e1.printStackTrace();
					}
               	 System.out.println("End of submit()");
                }
            });
        }
        
        text = new Text(group, SWT.BORDER);
        text.setBounds(172, 1261, 672, 41);
        text.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
        
        }
      
        tragetdate = new Text(group, SWT.BORDER);
    	tragetdate.setBounds(637, 540, 144, 21);
    	tragetdate.setForeground(SWTResourceManager.getColor(0, 0, 0));
    	tragetdate.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
    	tragetdate.setEditable(false);
    	tragetdate.setBackground(SWTResourceManager.getColor(255, 255, 255));
    	final Label labelDate = new Label(group, SWT.NONE);
    	labelDate.setImage(SWTResourceManager.getImage(EditDefectDetailGUI.class, "/icons/calendar_icon.gif"));
    	labelDate.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
    	labelDate.setBounds(615, 540, 21, 21);
    	 labelDate.setEnabled(true);
    	labelDate.addMouseTrackListener(new MouseTrackAdapter() {
            @Override
            public void mouseHover(MouseEvent e) {
                final Cursor cursor = new Cursor(Display.getCurrent(),
                        SWT.CURSOR_HAND);

                labelDate.setCursor(cursor);
            }
        });
    	labelDate.addMouseListener(new MouseAdapter() {
              @Override
              public void mouseDown(MouseEvent e) {

            	  	labelDate.setEnabled(false);
    				final Shell dialog = new Shell (shell, SWT.DIALOG_TRIM);
    				dialog.setLayout (new GridLayout (1, false));
    				
    				final DateTime calendar = new DateTime (dialog, SWT.CALENDAR | SWT.BORDER);
    				final DateTime date = new DateTime (dialog, SWT.DATE | SWT.SHORT);
    				final DateTime time = new DateTime (dialog, SWT.TIME | SWT.SHORT);
    				date.setVisible(false);
					time.setVisible(false);
    				calendar.addListener(SWT.MouseDoubleClick, new Listener() {
			        	 public void handleEvent(Event e) {
			        		 
			        		 tragetdate.setText(""+ (calendar.getMonth () + 1) + "/" + calendar.getDay () + "/" + calendar.getYear ());
			        		 dialog.close ();
			        		 labelDate.setEnabled(true);
			        		
			        	 }
					});
    				
    				dialog.pack ();
    				dialog.open ();
    			
              }
          });
    	
    	{
        	project = new Combo(group, SWT.NONE);
        	project.setItems(new String[] {"LoanPath"});
        	project.setBounds(172, 392, 166, 21);
        }
        {
        	Label lblPackage = new Label(group, SWT.BORDER | SWT.RIGHT);
        	lblPackage.setBounds(444, 369, 166, 21);
        	lblPackage.setText("Package:");
        	lblPackage.setForeground(SWTResourceManager.getColor(0, 0, 0));
        	lblPackage.setFont(SWTResourceManager.getFont("Tahoma", 9, SWT.NORMAL));
        	lblPackage.setBackground(SWTResourceManager.getColor(216, 228, 248));
        }
        {
        	packagecombo = new CCombo(group, SWT.BORDER);
        	if(defect.get_package() != null){
        	 packagecombo.setText(defect.get_package());
        	}
        	packagecombo.setBounds(615, 369, 166, 21);
        	packagecombo.setItems(new String[] {"TUS-Configuration tab", "TUS-Doc Mgmt.", "TUS-DD"});
        }
        {
        	state = new CCombo(group, SWT.BORDER);
        	if(defect.getState() != null){
        		state.setText(defect.getState());
           	}
        	state.setBounds(172, 430, 93, 21);
        	state.setItems(new String[] {"Open", "Re-Open", "Fixed", "Closed"});
        }
        {
        	envcombo = new Combo(group, SWT.NONE);
        	envcombo.setBounds(615, 430, 166, 21);
        	envcombo.setItems(new String[] {"SPortal", "Development", "Cluster(3P)", "Test", "Other"});
        }
        {
        	Combo severtycombo = new Combo(group, SWT.NONE);
        	severtycombo.setBounds(615, 452, 165, 21);
        	severtycombo.setItems(new String[] {"Crash/Data Loss", "Major Problem", "Major Problem", "Cosmetic"});
        }
        {
        	priority = new CCombo(group, SWT.BORDER);
        	if(defect.getPriority() != null){
        		priority.setText(defect.getPriority());
           	}
        	priority.setBounds(172, 452, 93, 21);
        	priority.setItems(new String[] {"High Attention", "Normal", "Low"});
        }
        {
        	submittedby = new CCombo(group, SWT.BORDER);
        	DefectsTabGUI.setUsers(submittedby);
        	submittedby.setBounds(172, 474, 93, 21);
        }
        {
        	Scheduledstate = new CCombo(group, SWT.BORDER);
        	Scheduledstate.setBounds(172, 645, 93, 21);
        	Scheduledstate.setItems(new String[] {"Completed", "Defined", "In-progess", "Accepted", "", ""});
        }
        {
        	release = new Combo(group, SWT.NONE);
        	release.setBounds(172, 623, 93, 21);
        	release.setItems(new String[] {"Unscheduled", "Realse 1.0", "Realse 1.2", "Realse 1.1", "Realse 2.0", ""});
        }
        {
        	Combo iteration = new Combo(group, SWT.NONE);
        	iteration.setBounds(615, 640, 166, 21);
        	iteration.setItems(new String[] {"Unscheduled", "Post RC15 Unscheduled Trunk Fixes"});
        }
        {
        	cseverity = new CCombo(group, SWT.BORDER);
        	if(defect.getCitiSeverity() != null){
        		cseverity.setText(defect.getCitiSeverity());
           	}
        	cseverity.setBounds(172, 748, 93, 21);
        	cseverity.setItems(new String[] {"Critical", "High", "Medium", "Low"});
        }
        {
        	Button blocked = new Button(group, SWT.CHECK);
        	blocked.setBounds(615, 623, 13, 16);
        	blocked.setSelection(true);
        }
        {
        	Button affectsdoc = new Button(group, SWT.CHECK);
        	affectsdoc.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
        	affectsdoc.setBounds(616, 566, 13, 16);
        	affectsdoc.setSelection(true);
        }
        
        root_cause = new CCombo(group, SWT.BORDER);
        if(defect.getRootCause() != null)
         root_cause.setText(defect.getRootCause());
        root_cause.setBounds(172, 898, 166, 21);
        root_cause.setItems(new String[] {"Coding Error / Lack of Unit Testing", "Cosmetic", "Caused due to another defect fix", "Deployment Issue","Improper Design","Refactoring / Reusability missing","Requirement no clarified / followed","Standards not followed","Technical / Architecture Limitations","Testing Environment Not available","Others"});
        {
        	Button button_1 = new Button(group, SWT.CHECK);
        	button_1.setBounds(172, 880, 13, 16);
        	button_1.setSelection(true);
        }
        
        Label lblUserStory = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblUserStory.setBounds(0, 581, 166, 21);
        lblUserStory.setText("User Story:");
        lblUserStory.setForeground(SWTResourceManager.getColor(0, 0, 0));
        lblUserStory.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        lblUserStory.setBackground(SWTResourceManager.getColor(216, 228, 248));
        
        resolution = new Combo(group, SWT.NONE);
        resolution.setBounds(172, 538, 93, 21);
        resolution.setItems(new String[] {"Pradeep Ohri", "Tanu", "Praveen Jain", "hgupta"});
        
        Label lblTestCase = new Label(group, SWT.BORDER | SWT.RIGHT);
        lblTestCase.setBounds(444, 583, 166, 21);
        lblTestCase.setText("Test Case:");
        lblTestCase.setForeground(SWTResourceManager.getColor(0, 0, 0));
        lblTestCase.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        lblTestCase.setBackground(SWTResourceManager.getColor(216, 228, 248));
        
        /*txtSearchTestCase = new Text(group, SWT.BORDER);
        txtSearchTestCase.setBounds(616, 584, 166, 21);
        txtSearchTestCase.setText("Search Test Case");
        txtSearchTestCase.setForeground(SWTResourceManager.getColor(0, 0, 0));
        txtSearchTestCase.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
        txtSearchTestCase.setBackground(SWTResourceManager.getColor(255, 255, 255));*/
        
        Button button_1 = new Button(group, SWT.CHECK);
        button_1.setBounds(172, 561, 13, 16);
        button_1.setSelection(true);
        button_1.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
        
        Label label = new Label(group, SWT.NONE);
        label.setBounds(165, 0, 684, 20);
        label.setBackground(SWTResourceManager.getColor(122, 150, 223));
        
    	
    	
        scrolledComposite.setContent(composite);
    	scrolledComposite.setMinSize(new Point(859, 1355));
        
        }catch(Exception e){
        	e.printStackTrace();
        }
        
      
    }
    
    private static void editDefectDetails(){
    	System.out.println("defect=="+defect);
    	if(defect != null){
    		System.out.println("in editDefectDetails method");
    		if(packagecombo.getText() != null && packagecombo.getText().trim().length() > 0){
    			System.out.println("packagecombo.getText()=="+packagecombo.getText());
    			defect.set_package(packagecombo.getText());
    		}
    		if(state.getText() != null && state.getText().trim().length() > 0){
    			defect.setState(state.getText());
    		}
    		if(priority.getText() != null && priority.getText().length() > 0){
    			defect.setPriority(priority.getText());
    		}
    		if(submittedby.getText() != null && submittedby.getText().trim().length() > 0){
    			defect.setSubmittedBy(submittedby.getText());
    		}
    		
    		if(found_in.getText() != null && found_in.getText().trim().length() > 0){
    			System.out.println("found_in.getText()=="+found_in.getText());
    			defect.setFoundInBuild(found_in.getText());
    		}
    		if(target_build.getText() != null && target_build.getText().trim().length() > 0){
    			System.out.println("target_build.getText()=="+target_build.getText());
    			defect.setTargetBuild(target_build.getText());
    		}
    		if(resolution.getText() != null && resolution.getText().trim().length() > 0){
    			defect.setResolution(resolution.getText());
    		}
    		if(envcombo.getText() != null && envcombo.getText().trim().length() > 0){
    			defect.setEnvironment(envcombo.getText());
    		}
    		if(fixed_in.getText() != null && fixed_in.getText().trim().length() > 0){
    			defect.setFixedInBuild(fixed_in.getText());
    		}
    		if(verified_in.getText() != null && verified_in.getText().trim().length() > 0){
    			defect.setVerifiedInBuild(verified_in.getText());
    		}
    		/*if(release.getText() != null && release.getText().trim().length() > 0){
    			defect.setRelease(release.getText());
    		}*/
    		if(Scheduledstate.getText() != null && Scheduledstate.getText().trim().length() > 0){
    			defect.setScheduleState(Scheduledstate.getText());
    		}
    		if(plan_estimate.getText() != null && plan_estimate.getText().trim().length() > 0){
    			defect.setPlanEstimate(new Double(plan_estimate.getText()));
    		}
    		if(cseverity.getText() != null && cseverity.getText().trim().length() > 0){
    			defect.setCitiSeverity(cseverity.getText());
    		}
    		if(client_def_id.getText() != null && client_def_id.getText().trim().length() > 0){
    			defect.setClientDefectID(client_def_id.getText());
    		}
    		if(root_cause.getText() != null && root_cause.getText().trim().length() > 0){
    			defect.setRootCause(root_cause.getText());
    		}
           
    		if(text.getText() != null && text.getText().trim().length() > 0){
    			 java.util.GregorianCalendar calendar = new java.util.GregorianCalendar();
    	            String date = String.valueOf(calendar.get(Calendar.DATE));
    	            String month = String.valueOf(calendar.get(Calendar.MONTH));
    	            String year = String.valueOf(calendar.get(Calendar.YEAR));
    	            String hour = String.valueOf(calendar.get(Calendar.HOUR));
    	            String minute = String.valueOf(calendar.get(Calendar.MINUTE));
    	            String second = String.valueOf(calendar.get(Calendar.SECOND));
    	            
    	            String timeStamp = date+"/"+month+"/"+year+"::"+hour+":"+minute+":"+second;
    	            String user = HeaderPage.userNameFromRally;
    	    		String defectNotes = " ["+timeStamp+" "+user+"]:"+text.getText() +" <br>";
    	    		defectNotes += defect.getNotes();
    			defect.setNotes(defectNotes);
    		}
    		
    		
    		
    	    RallyMain.updateObject(defect);
    		
    	}
    	
    }
}